/*
 * Copyright (c) ShaoxiongDu <Shaoxiong.dev@aliyun.com> 2021 all Rights Reserved
 */

package zh.codegym.task.task09.task0921;

import java.util.ArrayList;
import java.util.Scanner;

/* 
try-catch 中的方法
*/

public class Solution {
    public static void main(String[] args) {
        readData();
    }

    public static void readData() {
        //在此编写你的代码
        ArrayList<Integer> list = new ArrayList<>();
        Scanner scanner = new Scanner(System.in);

        try {
            while (true) {
                String iuput = scanner.next();
                int n = Integer.parseInt(iuput);
                list.add(n);
            }
        } catch (NumberFormatException e) {

            for (Integer integer : list) {
                System.out.println(integer);
            }

        }

    }
}
